package com.wechat.controller;

import com.jfinal.core.Controller;
import com.jfinal.weixin.sdk.api.ApiResult;
import com.jfinal.weixin.sdk.api.TemplateData;
import com.jfinal.weixin.sdk.api.TemplateMsgApi;

public class User extends Controller {

	 public void index() {
		 String wxid = getPara("wxid");
		 //oW-vn1f0vGa3JgoZvtvpGqlS76Tk
	    	ApiResult result = TemplateMsgApi.send(TemplateData.New()
	    			// 消息接收者
	    			.setTouser(wxid)
	    			// 模板id
	    			.setTemplate_id("x90A8oxI10PX-rwRPl_Uy-gr213MqWq2rftOqAyfAdA")
	    			.setUrl("https://www.wisheso.com")
	    			// 模板参数
	    			.add("first", "恭喜你购买成功！\n", "#999")
	    			.add("keyword1", "iPhoneX", "#999")
	    			.add("keyword2", "100000", "#999")
	    			.add("keyword3", "9999", "#999")
	    			.add("keyword4", "2018-10-19", "#999")
	    			.add("remark", "\n感谢您的购买！", "#999")
	    			.build());
	    	renderHtml("<h1>提醒发送成功！</h1>");
	    }
	 public void uploadImg() {
		 renderText("图片上传成功");
	 }
}
